#ifndef CROOM_H
#define CROOM_H

#include <QObject>
#include "CCommandHandler.h"
class CChatServer;
class CChatSession;
class CHandler : public CCommandHandler
{
    Q_OBJECT
public:
    explicit CHandler(CChatServer*s,QObject *parent = nullptr) : CCommandHandler(parent)
    {
        server=s;
    }
    virtual void add(CChatSession*session)
    {
        sessions.append(session);
    }
    virtual void remove(CChatSession*session)
    {
        sessions.removeOne(session);
    }
    virtual void broadcast(QByteArray line);
    virtual void handle(CChatSession*session,QByteArray line);
signals:

public slots:
public:
    CChatServer*server;
    QList<CChatSession*>sessions;
};

#endif // CROOM_H
